package com.em.sugarfight.sugarEnums;

import lombok.Getter;

@Getter
public enum Direction {
    N("N"), U("U"), D("D"), L("L"), R("R");

    private final String value;

    Direction(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return value;
    }

    /**
     * 获取方向的位移向量
     */
    public int[] getDelta() {
        switch (this) {
            case U: return new int[]{0, 1};
            case D: return new int[]{0, -1};
            case L: return new int[]{-1, 0};
            case R: return new int[]{1, 0};
            case N:
            default: return new int[]{0, 0};
        }
    }
}
